###############################################################
# Values, Taboos, and Votes: 
# How Basic Human Values Affect Populist Electoral Support
#
# Ugur Ozdemir, Marc S. Jacob
# 2021
# SEM TABLES
###############################################################

library(semTable)

vlabs <-
  c(
    sec = "Security",
    univ = "Universalism",
    conf = "Conformity",
    kp1_3320e = "Security 1",
    kp1_3320m = "Security 2",
    kp1_3320c = "Universalism 1",
    kp1_3320h = "Universalim 2",
    kp1_3320u = "Univeralism 3",
    kp1_3320n = "Conformity 1",
    kp1_3320q = "Conformity 2",
    Immigrat1 = "Immigration",
    MigInteg1 = "Integration",
    SecPriv1 = "Privacy",
    EuInteg1 = "EU Integration",
    SocEcon1 = "Socio-Economy",
    Climate1 = "Climate",
    Educ = "Education",
    Relig = "Religion",
    Immigrat1IDESec = "Security to Immigration",
    MigInteg1IDESec = "Security to Integration",
    SecPriv1IDESec = "Security to Privacy",
    EuInteg1IDESec = "Security to EU Integration",
    SocEcon1IDESec = "Security to Socio-Economy",
    Climate1IDESec = "Security to Climate",
    sumIDESec = "Security to Total Issue Opinions",
    totalSec = "Security Total Effects",
    Immigrat1IDEUniv = "Universalism to Immigration",
    MigInteg1IDEUniv = "Universalism to Integration",
    SecPriv1IDEUniv = "Universalism to Privacy",
    EuInteg1IDEUniv = "Universalism to EU Integration",
    SocEcon1IDEUniv = "Universalism to Socio-Economy",
    Climate1IDEUniv = "Universalism to Climate",
    sumIDEUniv = "Universalism to Total Issue Opinions",
    totalUniv = "Universalism Total Effects",
    Immigrat1IDEConf = "Conformity to Immigration",
    MigInteg1IDEConf = "Conformity to Integration",
    SecPriv1IDEConf = "Conformity to Privacy",
    EuInteg1IDEConf = "Conformity to EU Integration",
    SocEcon1IDEConf = "Conformity to Socio-Economy",
    Climate1IDEConf = "Conformity to Climate",
    sumIDEConf = "Conformity to Total Issue Opinions",
    totalConf = "Conformity Total Effects",
    ostwest = "West-born",
    populist = "Populist Vote"
  )


####MAIN MODELS####

semTable(
  fitAfD,
  type = "latex",
  table.float = TRUE,
  varLabels = vlabs,
  longtable = TRUE,
  alpha = c(0.05, 0.01, 0.001),
  columns = c(estsestars = "Estimate (Std. Err.)", z = "z")
)

semTable(
  fitLeft,
  type = "latex",
  table.float = TRUE,
  varLabels = vlabs,
  longtable = TRUE,
  alpha = c(0.05, 0.01, 0.001),
  columns = c(estsestars = "Estimate (Std. Err.)", z = "z")
)

semTable(
  fitCDU,
  type = "latex",
  table.float = TRUE,
  varLabels = vlabs,
  longtable = TRUE,
  alpha = c(0.05, 0.01, 0.001),
  columns = c(estsestars = "Estimate (Std. Err.)", z = "z")
)

semTable(
  fitSPD,
  type = "latex",
  table.float = TRUE,
  varLabels = vlabs,
  longtable = TRUE,
  alpha = c(0.05, 0.01, 0.001),
  columns = c(estsestars = "Estimate (Std. Err.)", z = "z")
)

semTable(
  fitGreens,
  type = "latex",
  table.float = TRUE,
  varLabels = vlabs,
  longtable = TRUE,
  alpha = c(0.05, 0.01, 0.001),
  columns = c(estsestars = "Estimate (Std. Err.)", z = "z")
)

semTable(
  fitFDP,
  type = "latex",
  table.float = TRUE,
  varLabels = vlabs,
  longtable = TRUE,
  alpha = c(0.05, 0.01, 0.001),
  columns = c(estsestars = "Estimate (Std. Err.)", z = "z")
)


####SUPPLEMENTALS I MODELS####

semTable(
  list(
    "West (Split Sample)" = fitAfDwest,
    "East (Split Sample)" = fitAfDeast
  ),
  type = "latex",
  table.float = TRUE,
  varLabels = vlabs,
  longtable = TRUE,
  alpha = c(0.05, 0.01, 0.001),
  columns = c(estsestars = "Estimate (Std. Err.)")
)

semTable(
  list(
    "West (Split Sample)" = fitLeftwest,
    "East (Split Sample)" = fitLefteast
  ),
  type = "latex",
  table.float = TRUE,
  varLabels = vlabs,
  longtable = TRUE,
  alpha = c(0.05, 0.01, 0.001),
  columns = c(estsestars = "Estimate (Std. Err.)")
)

semTable(
  list(
    "West (Split Sample)" = fitCDUwest,
    "East (Split Sample)" = fitCDUeast
  ),
  type = "latex",
  table.float = TRUE,
  varLabels = vlabs,
  longtable = TRUE,
  alpha = c(0.05, 0.01, 0.001),
  columns = c(estsestars = "Estimate (Std. Err.)")
)

semTable(
  list(
    "West (Split Sample)" = fitSPDwest,
    "East (Split Sample)" = fitSPDeast
  ),
  type = "latex",
  table.float = TRUE,
  varLabels = vlabs,
  longtable = TRUE,
  alpha = c(0.05, 0.01, 0.001),
  columns = c(estsestars = "Estimate (Std. Err.)")
)

semTable(
  list(
    "West (Split Sample)" = fitGreenswest,
    "East (Split Sample)" = fitGreenseast
  ),
  type = "latex",
  table.float = TRUE,
  varLabels = vlabs,
  longtable = TRUE,
  alpha = c(0.05, 0.01, 0.001),
  columns = c(estsestars = "Estimate (Std. Err.)")
)

semTable(
  list(
    "West (Split Sample)" = fitFDPwest,
    "East (Split Sample)" = fitFDPeast
  ),
  type = "latex",
  table.float = TRUE,
  varLabels = vlabs,
  longtable = TRUE,
  alpha = c(0.05, 0.01, 0.001),
  columns = c(estsestars = "Estimate (Std. Err.)")
)

semTable(
  fitpopulist,
  type = "latex",
  table.float = TRUE,
  varLabels = vlabs,
  longtable = TRUE,
  alpha = c(0.05, 0.01, 0.001),
  columns = c(estsestars = "Estimate (Std. Err.)", z = "z")
)
